/**
 * ****************************** ICE *******************************
 * ========================================================================
 * Project:  basicsipcall
 * Package: org.ice4apps.talk.callManager.Features.Routing 
 * File:  Routing.java
 * Author: biju
 * Date: Feb 15, 2010
 * Description:
 * ========================================================================
 */
package org.ice4apps.talk.callManager.Features.Preprocess;

import java.util.Vector;

import javax.servlet.ServletException;

import org.ice4apps.talk.callManager.FeatureMapping;
import org.ice4apps.talk.callManager.IceTalkFeature;
import org.ice4apps.talk.callManager.UserSession;
import org.ice4apps.talk.entity.UserSessionType;
import org.ice4apps.talk.entity.MessageType;

/**
 * @author biju
 * This class define the way the this feature will be registered with the State Machine
 *
 */
public class Preprocess {

	public static void Register(UserSession userSession, FeatureMapping featureMapping){
		
		if (UserSessionType.ORIGINATING == userSession.getUserSessionType()){
			Vector<IceTalkFeature> featureArray = featureMapping.getFeatureArray(
					UserSession.UserSessionState.INITIATING.ordinal(),MessageType.SIP_INVITE.ordinal());
			try {
				featureArray.add(new PreOrigInitiateInvite(userSession));
			} catch (ServletException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
